<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Update Event</title>
        <link rel="stylesheet" href="css/mycss.css" type="text/css"></link>
    </h:head>

    <body style="background-color:#F0FFFF"></body>

    <h:body>


        <f:metadata>
            <f:viewParam name="id" value="#{editEventBean.selected.id}" />
            <f:viewParam name="name" value="#{editEventBean.selected.eventname}" />
            <f:viewParam name="date" value="#{editEventBean.selected.eventdate}" />
            <f:viewParam name="place" value="#{editEventBean.selected.place}" />
            <f:viewParam name="type" value="#{editEventBean.selected.eventtype}" />
            <f:viewParam name="visibility" value="#{editEventBean.selected.visibility}" />
            <f:viewParam name="creator" value="#{editEventBean.selected.creator}" />
            <f:viewParam name="city" value="#{editEventBean.selected.city}" />
            <f:viewParam name="weather" value="#{editEventBean.selected.weather}" />
            <f:viewParam name="timestart" value="#{editEventBean.selected.timestart}" />
            <f:viewParam name="timefinish" value="#{editEventBean.selected.timefinish}" />
        </f:metadata>
        
        <f:event listener="#{access.isAdmin(event, editEventBean.selected.creator)}" type="preRenderView" />

        <h:form prependId="false">

            <em><font size="7"><h:outputText style="color: orange; position: absolute; 
                                             top: 30px; left: 60px;" value="Edit Event Form"/></font></em> 

            <h:panelGrid columns="3" id="regGrid" style="position: absolute; top: 100px; left: 60px;">

                <h:outputLabel for="name" style="font: 24px/26px colibri">Name:</h:outputLabel>
                <p:inputText id="name" value="#{editEventBean.selected.eventname}"/><br/>

                <h:outputLabel for="city" style="font: 24px/26px colibri">Place:</h:outputLabel>
                <p:inputText id="city" value="#{editEventBean.selected.city}"/><br/>

                <h:outputLabel for="place" style="font: 24px/26px colibri">Place:</h:outputLabel>
                <p:inputText id="place" value="#{editEventBean.selected.place}"/><br/>

                <h:outputLabel for="date" style="font: 24px/26px colibri">Date (DD/MM/YYY):</h:outputLabel>
                <p:inputMask id="date" value="#{editEventBean.selected.eventdate}" mask="99/99/9999"></p:inputMask><br/>

                <h:outputLabel for="timestart" style="font: 24px/26px colibri">Start Time</h:outputLabel>
                <p:inputText id="timestart" value="#{editEventBean.selected.timestart}"/><br/>

                <h:outputLabel for="timefinish" style="font: 24px/26px colibri">End Time</h:outputLabel>
                <p:inputText id="timefinish" value="#{editEventBean.selected.timefinish}"/><br/>

                <h:outputLabel for="type" style="font: 24px/26px colibri">Type:</h:outputLabel>
                <h:selectOneMenu id="type" value="#{editEventBean.selected.eventtype}" required="true"
                                 label="type" style="width:150px; height:30px; font: 18px/20px colibri">
                    <f:selectItem itemLabel="Select Type" itemValue="" noSelectionOption="true" />
                    <f:selectItem itemLabel="Indoor" itemValue="Indoor" />
                    <f:selectItem itemLabel="Outdoor" itemValue="Outdoor" />
                </h:selectOneMenu><br/>


                <h:outputLabel for="visibility" style="font: 24px/26px colibri">Visibility:</h:outputLabel>
                <h:selectOneMenu id="visibility" value="#{editEventBean.selected.visibility}" required="true"
                                 label="visibility" style="width:150px; height:30px; font: 18px/20px colibri">
                    <f:selectItem itemLabel="Select Visibility" itemValue="" noSelectionOption="true" />
                    <f:selectItem itemLabel="Public" itemValue="Public" />
                    <f:selectItem itemLabel="Private" itemValue="Private" />
                </h:selectOneMenu><br/>

                <h:outputLabel for="inviteone" style="font: 24px/26px colibri">Invite User 1:</h:outputLabel>
                <p:inputText id="inviteone" value="#{editEventBean.invited1}"/><br/>

                <h:outputLabel for="inviteone" style="font: 24px/26px colibri">Invite User 2:</h:outputLabel>
                <p:inputText id="invitetwo" value="#{editEventBean.invited2}"/><br/>

                <h:outputLabel for="inviteone" style="font: 24px/26px colibri">Invite User 3:</h:outputLabel>
                <p:inputText id="invitethree" value="#{editEventBean.invited3}"/><br/>

            </h:panelGrid>    

            <p:commandButton value="Update Event" update="regGrid" style="position: absolute; top: 500px;
                             left: 60px; background-color:#90A4FD" action="#{editEventBean.updateEvent()}" />

            <p:commandButton value="Back" update="regGrid" style="position: absolute; top: 500px;
                             left: 260px; background-color:#90A4FD" action="#{counter.count()}" />




        </h:form>

    </h:body>

</html>

